<?php
/**
 +------------------------------------------------------------------------------
 * JSON处理函数
 +----------------------------------------------------------
 * @param string $node 常理节点信息（FILENAME::ARRAY::ARRAYID）
 +----------------------------------------------------------
 * @return void
 +------------------------------------------------------------------------------
 */
class json
{
    private $_data = array();

    public function __call($m, $a)
    {
        $this->_data[$m] = $a;
        return $this;
    }

    public function __set($prop_name, $prop_value) {
        $this->_data[$prop_name] = $prop_value;
        return true;
    }

    public function __get($prop_name) {
        return $this->_data[$prop_name];
    }

    public static function tophp($str){
    	return json_decode($str);
    }
    
	public static function toJson($str){
    	echo json_encode($str);
    }
	
	public function out()
    {
        echo json_encode($this->_data);
    }
}
